package com.katian.metro;

import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * User: csavard
 * Date: 13-11-05
 */
public class MetroUtilTEst {

    @Test
    public void testMerge() throws IOException {
        InputStream input1 = getClass().getClassLoader().getResourceAsStream("com/katian/metro/13746-CHM_METR20131028.csv");
        InputStream input2 = getClass().getClassLoader().getResourceAsStream("com/katian/metro/13747-CHM_SUPERC20131028.csv");
        InputStream input3 = getClass().getClassLoader().getResourceAsStream("com/katian/metro/13748-LBM_METR20131028.csv");


        File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "com.katian");
        FileUtils.forceMkdir(file);
        file = new File(file.getAbsolutePath() + File.separator + "metro.csv");

        System.out.println("Write file to: " + file.getAbsolutePath());

        MetroUtil.mergeFiles(new FileOutputStream(file), input1, input2, input3);
    }
}
